<template>
  <!-- 多选项 Start -->
  <div class="multiple">
    {{ item.JobItemName }}
    <a-checkbox-group disabled :value="checkList">
      <a-row>
        <a-col :span="24" v-for="(item, index) in modifiedList" :key="index">
          <a-checkbox :value="item"> {{ item }} </a-checkbox>
        </a-col>
      </a-row>
    </a-checkbox-group>
  </div>
  <!-- 多选项 End -->
</template>

<script>
export default {
  props: ["item"],
  data() {
    return {
      modifiedList: [], //修改后的数组
      checkList: [], //选中的项
    };
  },
  watch: {
    item: {
      handler(newVal, oldVal) {
        /* 判断有选项时拆分为数值形式展示 */
        if (newVal && this.modifiedList.length == 0) {
          this.modifiedList = newVal.PackageSource.split(",");
        }
        /* 监听传入值,如SectionResultStr不为null则为已填写,既赋值 */
        if (
          this.item.SectionResultStr != null &&
          this.item.SectionResultStr != ""
        ) {
          this.checkList = this.item.SectionResultStr.split(",");
        }
      },
      immediate: true,
      deep: true,
    },
  },
};
</script>

<style lang="less" scoped>
/deep/ .ant-checkbox-group {
  width: 100%;

  .ant-row {
    .ant-col {
      .ant-checkbox-disabled {
        .ant-checkbox-inner::after {
          border-color: #000000 !important;
        }
      }

      .ant-checkbox-wrapper {
        span {
          color: #000000 !important;
          font-size: 0.8125rem !important;
        }
      }
    }
  }
}
</style>
